package lormi.meipin.service.impl;


import java.util.List;

import org.springframework.stereotype.Service;

import lormi.meipin.entity.Environment;
import lormi.meipin.exception.LMException;
import lormi.meipin.service.BaseService;
import lormi.meipin.service.IEnvironmentService;

@Service
public class EnvironmentService extends BaseService implements IEnvironmentService{

	@Override
	public Environment addOne(Environment environment) throws LMException {
		if (environmentMapper.insert(environment)<1) {
			throw new LMException(100035);
		}
		return environmentMapper.selectByUrl(environment.getPictureurl());
	}

	@Override
	public void delOneById(Integer id) {
		environmentMapper.deleteByPrimaryKey(id);
	}

	@Override
	public void editUrl(Environment environment) {
		environmentMapper.updateByPrimaryKey(environment);
	}

	@Override
	public List<Environment> getAll(Integer userid) {
		return environmentMapper.selectByMerId(userid);
	}

}
